From 6c44f7bf07ea7e58dc71a52366ef084aecabe153 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 6 Mar 2020 12:38:13 -0800 Subject: [PATCH] wayland: Stop tracking orphan dialogs Wayland has no concept of transient-for-group. If we want to support that, add proper proper protocol for it, don't hack it in this like. --- gdk/wayland/gdkdisplay-wayland.h | 3 -- gdk/wayland/gdksurface-wayland.c | 65 -------------------------------- 2 files changed, 68 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h index aa5797a331..a8e4364787 100644 --- a/gdk/wayland/gdkdisplay-wayland.h +++ b/gdk/wayland/gdkdisplay-wayland.h @@ -123,9 +123,6 @@ struct _GdkWaylandDisplay GList *event_queues; - /* Keep a list of orphaned dialogs (i.e. without parent) */ - GList *orphan_dialogs; - GList *current_popups; GList *current_grabbing_popups; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index de29755357..c387548e6d 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -255,17 +255,6 @@ gdk_wayland_surface_thaw_state (GdkSurface *surface) g_assert (!impl->display_server.xdg_popup); } -static void -_gdk_wayland_screen_add_orphan_dialog (GdkSurface *surface) -{ - GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); - - if (!g_list_find (display_wayland->orphan_dialogs, surface)) - display_wayland->orphan_dialogs = - g_list_prepend (display_wayland->orphan_dialogs, surface); -} - static void _gdk_wayland_surface_save_size (GdkSurface *surface) { @@ -952,37 +941,6 @@ gdk_wayland_surface_sync_parent_of_imported (GdkSurface *surface) impl->display_server.wl_surface); } -static void -gdk_wayland_surface_update_dialogs (GdkSurface *surface) -{ - GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); - GList *l; - - if (!display_wayland->orphan_dialogs) - return; - - for (l = display_wayland->orphan_dialogs; l; l = l->next) - { - GdkSurface *w = l->data; - GdkWaylandSurface *impl; - - if (!GDK_IS_WAYLAND_SURFACE (w)) - continue; - - impl = GDK_WAYLAND_SURFACE (w); - if (w == surface) - continue; - if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG) - continue; - if (impl->transient_for) - continue; - - /* Update the parent relationship only for dialogs without transients */ - gdk_wayland_surface_sync_parent (w, surface); - } -} - static void gdk_wayland_surface_sync_title (GdkSurface *surface) { @@ -1272,10 +1230,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface) default: g_assert_not_reached (); } - - if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG && - new_state & GDK_SURFACE_STATE_FOCUSED) - gdk_wayland_surface_update_dialogs (surface); } static void @@ -1633,9 +1587,6 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface) maybe_set_gtk_surface_dbus_properties (surface); maybe_set_gtk_surface_modal (surface); - if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG) - _gdk_wayland_screen_add_orphan_dialog (surface); - gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "surface commit"); wl_surface_commit (impl->display_server.wl_surface); } @@ -2545,10 +2496,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface) g_slist_free (impl->display_server.outputs); impl->display_server.outputs = NULL; - if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG && !impl->transient_for) - display_wayland->orphan_dialogs = - g_list_remove (display_wayland->orphan_dialogs, surface); - g_clear_pointer (&impl->popup.layout, gdk_popup_layout_unref); } @@ -3290,9 +3237,6 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface, GdkSurface *parent) { GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - GdkWaylandDisplay *display_wayland = - GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); - GdkSurface *previous_parent; g_assert (parent == NULL || gdk_surface_get_display (surface) == gdk_surface_get_display (parent)); @@ -3305,17 +3249,8 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface, unset_transient_for_exported (surface); - previous_parent = impl->transient_for; impl->transient_for = parent; - if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG) - { - if (!parent) - _gdk_wayland_screen_add_orphan_dialog (surface); - else if (!previous_parent) - display_wayland->orphan_dialogs = - g_list_remove (display_wayland->orphan_dialogs, surface); - } gdk_wayland_surface_sync_parent (surface, NULL); } -- 2.30.2